<% if @users.size > 0 %>
  <br />

  <table class="paginated_table sorted_table">
    <thead>
      <tr>
        <th>Usuario</th>
        <th>Nombre</th>
        <th>Institución cultural</th>
        <th>Rol</th>
        <th>Estado</th>
        <th>Opciones</th>
      </tr>
    </thead>
    <tbody>
      <% @users.each do |user| %>
        <tr>
          <td><%= user.username %></td>
          <td><%= user.name %> <%= user.lastname %></td>
          <td><%= user.obj_cultural_institution.name %></td>
          <td><%= user.obj_role.name %></td>
          <td><%= user.str_state %></td>
          <td>
            <%= link_to image_tag("navi/search-16-ns.png", :border => 0, :title => 'Mostrar'), {:action => 'show',:id => user.id}%>
            <%if (user.id != 1) && (user.state == 0)%>
              <%= link_to image_tag("navi/pencil-16-ns.png", :border => 0, :title => 'Editar'), {:action => 'edit_role_and_institution',:id => user.id}%>
            <%end%>
            <%if (user.id != 1)%>
              <%= link_to image_tag("navi/cross-16-ns.png", :border => 0, :title => 'Eliminar'), {:action => 'delete',:id => user.id}, {:confirm => '¿Realmente desea eliminar un usuario?'}%>
            <%end%>
            <%if (user.state == 0) || (user.state == 3)%>
              <%= link_to image_tag("navi/badge-square-check-16-ns.png", :border => 0, :title => 'Activar'), {:action => 'aprove',:id => user.id}%>
            <%end%>
            <%if (user.state == 0)%>
              <%= link_to image_tag("navi/badge-square-minus-16-ns.png", :border => 0, :title => 'Rechazar'), {:action => 'reject',:id => user.id}, {:confirm => '¿Realmente desea rechazar este usuario?'}%>
            <%end%>
            <%if (user.state == 1) && (user.id != 1)%>
              <%= link_to image_tag("navi/warning-16-ns.png", :border => 0, :title => 'Suspender'), {:action => 'suspend',:id => user.id}, {:confirm => '¿Realmente desea suspender este usuario?'}%>
            <%end%>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>
<% else %>
  <p>Ningún usuario encontrado.</p>

<% end %>